﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
/* This Model is responsible for keeping track of each transportation mean and its event!
 * It is also helping us in keeping track of the number of places required at each event's transportation mean and 
 * whether it is full by the users or not!
 * Each class contains create and modified times for security reasons
 */
namespace Fish.Models
{
    public class Transports
    {
        public int ID { get; set; }

        public int UsersID{get;set;}
        
        public string UserName { get; set; }

        [Required]
        public string ComingFrom { get; set; }

        public string CarDescription { get; set; }

        [Required]
        [Range(0, int.MaxValue, ErrorMessage = "Quantity must be a positive number")]
        public int NumberOfPlaces { get; set; }

        public virtual ICollection<Users> Passengers { get; set; }
        public virtual Users User { get; set; }

        [DataType(DataType.DateTime)]
        [ScaffoldColumn(false)]
        public DateTime Created { get; set; }

        [DataType(DataType.DateTime)]
        [ScaffoldColumn(false)]
        public DateTime Modified { get; set; }

        public virtual Events Event { get; set; }


        public Transports()
        {
            this.Passengers = new List<Users>();
            this.Created = DateTime.Now;
            this.Modified = DateTime.Now;
        }
    }
}